package com.member.common.enums;


import lombok.Getter;

import java.util.Objects;

/**
 * @author wangxin
 */
@Getter
public enum ReceiveStatusEnum {
    /**
     * 未使用
     */
    UNUSED(0, "未使用"),
    /**
     * 已使用
     */
    USED(1, "已使用"),

    /**
     * 已过期
     */
    EXPIRED( 2, "已过期"),
    ;

    private final Integer key;
    private final String desc;

    ReceiveStatusEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static ReceiveStatusEnum getByKey(Integer key){
        for (ReceiveStatusEnum item : ReceiveStatusEnum.values()){
            if(Objects.equals(item.getKey(), key)){
                return item;
            }
        }
        return null;
    }

}
